:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --surface: #0b0d10;
  --line: #272b31;
  --text: #d9dce1;
  --dim: #939ba6;
  --green: #a5c9ad;
  --blue: #a6bdd8;
  --yellow: #c8b696;
  --err: #e49a9a;
  --font: 'IBM Plex Mono', Consolas, monospace;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  padding: 0 max(28px, env(safe-area-inset-left)) 0 max(28px, env(safe-area-inset-right));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.85 var(--font);
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--blue); text-underline-offset: 4px; }
a:hover { color: var(--text); }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 4px; }
::selection { background: #697d9859; }
.site-header, .terminal, .site-footer { width: 100%; max-width: 1160px; margin-inline: auto; }
.site-header { position: relative; min-height: 84px; display: flex; align-items: center; flex-shrink: 0; }
.terminal-identity { display: flex; align-items: center; }
.brand { color: var(--text); font-size: 12px; font-weight: 500; letter-spacing: -.025em; }
.brand b { margin-right: 10px; color: var(--green); font-weight: 400; }
.terminal { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.titlebar { display: flex; align-items: center; min-height: 42px; flex-shrink: 0; border-bottom: 1px solid var(--line); }
.session-title { color: var(--dim); font-size: 10px; letter-spacing: .015em; }
.terminal-workspace { display: flex; flex: 1; min-height: 0; }
.screen {
  flex: 1; min-width: 0; min-height: 0; overflow: auto;
  padding: 30px 0; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.dim { color: var(--dim); }
.green { color: var(--green); }
.blue { color: var(--blue); }
.yellow { color: var(--yellow); }
.err { color: var(--err); }
.spacer { height: 14px; }
.command-echo {
  margin: 26px 0 12px; padding-top: 14px;
  border-top: 1px solid var(--line);
  white-space: pre-wrap; overflow-wrap: anywhere;
  color: var(--text); font-weight: 500;
}
.echo-prompt { color: var(--green); font-weight: 400; }
.help-row { display: grid; grid-template-columns: 24ch 1fr; gap: 18px; padding: 7px 0; }
.help-name { color: var(--blue); }
.help-description { color: var(--dim); }
.command-dock { flex-shrink: 0; border-top: 1px solid var(--line); padding: 10px 0 12px; }
.prompt-head { display: none; }
.input-row { display: flex; align-items: center; gap: 14px; min-height: 52px; }
.dollar { color: var(--green); font-size: 16px; }
#cmd {
  width: 100%; min-width: 0; flex: 1; min-height: 44px;
  border: 0; outline: 0; padding: 6px 0; border-radius: 0;
  background: transparent; color: var(--text); caret-color: var(--green);
}
#cmd::placeholder { color: var(--dim); opacity: .85; }
.input-row:focus-within { box-shadow: inset 0 -1px var(--blue); }
.run-button { width: 44px; height: 44px; padding: 0; flex-shrink: 0; border: 0; border-radius: 4px; background: transparent; color: var(--dim); font-size: 18px; }
.run-button:hover { color: var(--green); }
.site-footer { min-height: 48px; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 20px; flex-shrink: 0; color: var(--dim); font-size: 9px; }
.clock { margin-left: auto; font-size: 9px; font-variant-numeric: tabular-nums; }
.footer-keys { display: flex; gap: 16px; margin-left: auto; }
kbd { color: var(--text); font: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* The approved transparent character stays inside the top-right corner. */
.coding-companion { position: absolute; top: 4px; right: 0; width: clamp(180px,22vw,210px); aspect-ratio: 1; pointer-events: none; z-index: 2; }
.coding-companion[hidden] { display: none; }
.companion-sprite { width: 100%; height: 100%; background-size: 200% 200%; background-repeat: no-repeat; background-position: 0 0; }
.has-companion .screen::before { content: ''; float: right; width: clamp(180px,22vw,210px); height: 90px; }

@media (max-width: 640px) {
  body { padding: 0 max(14px,env(safe-area-inset-right)) env(safe-area-inset-bottom) max(14px,env(safe-area-inset-left)); font-size: 12px; }
  .site-header { min-height: 64px; }
  .brand { font-size: 11px; }
  .titlebar { min-height: 40px; }
  .session-title { font-size: 9px; }
  .screen { padding: 24px 0; }
  .coding-companion { width: 140px; top: 0; }
  .has-companion .screen::before { width: 145px; height: 56px; }
  .help-row { grid-template-columns: 1fr; gap: 1px; padding-block: 9px; }
  .help-description { font-size: 11px; }
  .command-echo { margin-top: 22px; padding-top: 12px; }
  #cmd { font-size: 16px; }
  .command-dock { padding-block: 6px; }
  .site-footer { min-height: 42px; padding-block: 7px; gap: 4px 10px; font-size: 8px; }
  .clock, .desktop-hint { display: none; }
  .footer-keys { gap: 10px; }
}
@media (max-height: 560px) {
  .coding-companion, .has-companion .screen::before { display: none; }
  .site-header { min-height: 38px; }
  .titlebar { min-height: 30px; }
  .screen { padding-top: 14px; }
  .site-footer { min-height: 28px; }
  .command-dock { padding-block: 2px; }
}
